home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 8: LINUX Games / Linux Cubed Series 8 - LINUX Games.iso / games / x11 / networke / xfirepow.000 / xfirepow / xfirepower-0.84 / client / libsprite / Wlib.h < prev    next >
C/C++ Source or Header  |  1995-06-14  |  7KB  |  196 lines

  1. /* Wlib.h
  2.  *
  3.  * Include file for the Windowing interface.
  4.  *
  5.  * Kevin P. Smith  6/11/89
  6.  *
  7.  * The deal is this:
  8.  *   Call W_Initialize(), and then you may call any of the listed fuinctions.
  9.  *   Also, externals you are allowed to pass or use include W_BigFont,
  10.  *     W_RegularFont, W_UnderlineFont, W_HighlightFont, W_White, W_Black,
  11.  *     W_Red, W_Green, W_Yellow, W_Cyan, W_Grey, W_Textwidth, and W_Textheight.
  12.  */
  13.  
  14. #ifndef Wlib_h_
  15. #define Wlib_h_
  16.  
  17. #define AUTOKEY
  18.  
  19. #include <X11/Xlib.h>
  20. #include "copyright2.h"
  21.  
  22. struct window;
  23.  
  24. #ifdef __STDC__
  25. #define P(s) s
  26. #else
  27. #define P(s) ()
  28. #endif
  29.  
  30. /* image struct to hold all info about an image, be it a bitmap or 
  31.    pixmap.  Replaces W_Icon.  [BDyess] */
  32. typedef struct {
  33.   /* public */
  34.   unsigned int width, height, frames;    /* frames = nviews for ships */
  35.   int xpm;            /* is it a Pixmap (> 1 plane) or not */
  36.   char *filename;        /* filename without .xpm/.xbm extension*/
  37.   int loaded;            /* 1 if loaded (for on-demand loading) */
  38.   int alternate;        /* offset into images array for alternate
  39.                                    image to use if this one can't be
  40.                    loaded */
  41.   int bad;            /* if set, loading failed */
  42.   int compiled_in;        /* image is compiled into the binary */
  43.   unsigned char *xbmdata;    /* ptr to compiled in xbm data.  Only valid */
  44.                                 /* if compiled_in is true. */
  45.   char **xpmdata;        /* ptr to compiled in xpm data.  Only valid */
  46.                                 /* if compiled_in is true. */
  47.   /* X Data structures (private) */
  48.   Pixmap pixmap, clipmask;    /* clipmask only used if in xpm mode */
  49. } W_Image;
  50.  
  51. typedef struct {
  52.     short x,y;
  53. } W_Point;
  54.  
  55. /*typedef char *W_Window;*/
  56. typedef char *W_Icon;
  57. typedef char *W_Font;
  58. typedef int W_Color;
  59.  
  60. typedef int (*W_Callback) ();
  61. typedef char *W_Window;
  62.  
  63. extern W_Font W_BigFont, W_RegularFont, W_UnderlineFont, W_HighlightFont;
  64. extern W_Color W_White, W_Black, W_Red, W_Green, W_Green2, W_Blue, W_Yellow, W_Cyan, W_Grey, W_DarkGrey, W_DarkGreen, W_Brown;
  65. extern int W_Textwidth, W_Textheight, W_BigTextwidth, W_BigTextheight;
  66. extern int W_FastClear;
  67.  
  68. #define W_EV_EXPOSE    1
  69. #define W_EV_KEY    2
  70. #define W_EV_BUTTON    3
  71.  
  72. #ifdef AUTOKEY
  73. #define W_EV_KEY_OFF    4
  74. #endif                /* AUTOKEY */
  75.  
  76. #define W_LBUTTON    1
  77. #define W_MBUTTON    2
  78. #define W_RBUTTON    3
  79.  
  80. typedef struct event {
  81.     int     type;
  82.     W_Window Window;
  83.     int     key;
  84.     int     x, y;
  85. }       W_Event;
  86.  
  87. #define W_BoldFont W_HighlightFont
  88.  
  89. /*#define W_StringWidth(st,font) (strlen(st)*W_Textwidth)*/
  90.  
  91. #if 0
  92. /* Don't even know what this is supposed to do... */
  93. #define W_SetSensitive(w,b)
  94. #endif /*0*/
  95.  
  96. extern int autoPoint, W_KeyDepth, animPointers, useWorkbench;
  97. extern unsigned long w_socket;
  98. #endif    /* AMIGA */
  99.  
  100. #if 0
  101. void W_FreeImage P((W_Image *image));
  102. W_Image * W_BitmapToImage P((unsigned int width, unsigned int height, char *bits));
  103. void W_DrawImage P(( W_Window window, int x, int y, int frame, W_Image *image, 
  104.     W_Color color));
  105.  
  106. extern void W_WritePixmap P((W_Window window, int x, int y, int frame,
  107.     W_Icon bit));
  108. extern W_Icon W_StorePixmap P((char *filename, int frames));
  109.  
  110. void W_ClearBuffer P((W_Window window));
  111. int W_IsBuffered P((W_Window window));
  112. void W_Buffer P((W_Window window, int on));
  113. void W_DisplayBuffer P((W_Window window));
  114.  
  115. void W_DrawImageBar P((W_Window win, int x, int y, int len, W_Image *image));
  116. void W_FillArea P((W_Window window, int x, int y, unsigned int width, unsigned int height, 
  117.     W_Color color));
  118. extern void W_GetPixmapInfo P((W_Icon pixmap, int *width, int *height, 
  119.     int *frames));
  120. extern void W_DrawShield P((W_Window window, int centerx, int centery, 
  121.     int diameter, W_Color color));
  122. extern void W_Initialize P((char *display));
  123. extern W_Window W_MakeWindow P((char *name, int x, int y, int width, 
  124.     int height, W_Window parent, char *cursname, int border, 
  125.     W_Color color));
  126. extern W_Icon W_StoreBitmap P((int width, int height, char *data));
  127. extern void W_FreeBitmap P((W_Icon bit));
  128. extern W_Window W_MakeTextWindow P((char *name, int x, int y, int width, 
  129.     int height, W_Window parent, char *cursname, int border));
  130. extern W_Window W_MakeScrollingWindow P((char *name, int x, int y, int width,
  131.     int height, W_Window parent, char *cursname, int border));
  132. extern W_Window W_MakeMenu P((char *name, int x, int y, int width, int height,
  133.     W_Window parent, int border));
  134. extern void W_WriteText P((W_Window window, int x, int y, W_Color color,
  135.     char *str, int len, W_Font font));
  136. void W_MaskText P((W_Window window, int x, int y, W_Color color,
  137.     char *str, int len, W_Font font));
  138. extern void W_DirectMaskText P((W_Window window, int x, int y, W_Color color,
  139.     char *str, int len, W_Font font));
  140. extern void W_WriteBitmap P((W_Window win, int x, int y, W_Icon icon, W_Color color));
  141. extern void W_CacheClearArea();
  142.  
  143. extern void W_ClearArea( /* window, x, y, width, height, color */ );
  144. extern void W_MakeLine( /* window, x0, y0, x1, y1, color */ );
  145. extern void W_DrawPoint( /* window, x, y, color */ );
  146. void W_MapWindow( /* window */ );
  147. extern void W_UnmapWindow( /* window */ );
  148. extern int W_EventsPending( /* void */ );
  149. extern void W_NextEvent( /* W_Event *event */ );
  150. extern void W_TileWindow( /* window, bitmap */ );
  151. extern void W_UnTileWindow( /* window */ );
  152. extern void W_ChangeBorder( /* window, color */ );
  153. extern void 
  154. W_DefineCursor(    /* window, width, height, data, mask, xhot, yhot */ );
  155. extern int W_IsMapped( /* window */ );
  156. extern void W_Beep( /* void */ );
  157. extern void W_DestroyWindow( /* window */ );
  158. extern int W_WindowWidth( /* window */ );
  159. extern int W_WindowHeight( /* window */ );
  160. extern int W_Socket( /* void */ );
  161. extern void W_ClearWindow( /* window */ );
  162. extern void W_SetIconWindow( /* mainwindow, iconwindow */ );
  163. extern int W_StringWidth( /* string, font */ );
  164. extern void W_TranslatePoints( /* window, x, y */ );
  165. extern void W_ResizeWindow( /* window, neww, newh */ );
  166. extern void W_ResizeMenu( /* window, neww, newh */ );
  167. extern void W_ResizeText( /* window, neww, newh */ );
  168. extern void W_Deiconify( /* window */ );
  169. extern void W_GetMouse();
  170. extern void W_BlankCursor();
  171. extern void W_Flush();
  172.  
  173. extern W_Icon W_MakeShieldBitmap( /* width,height, window */ );
  174.  
  175. extern W_Image *W_CreateCombinedImage();
  176.  
  177. #endif
  178.  
  179. #include "Wproto.h"
  180.  
  181. #ifdef AMIGA
  182. void switchScreen();
  183. /* things ignored or different for now: */
  184. /* some laziness on my part, mostly just unneeded. */
  185. #define W_CacheLine W_MakeLine
  186. #define W_CachePoint W_DrawPoint
  187. #define W_FlushPointCaches(w)
  188. #define W_FlushLineCaches(w)
  189. #define W_DefineTextCursor(w) W_DefineMessageCursor(w)
  190. #define W_RevertCursor(w) W_DefineTCrossCursor(w)
  191. #define W_RenameWindow(w,s)
  192.  
  193. extern W_Icon W_ReadPixmap(W_Window window, char *path, char *name, int width, int height, int x, int y, int mask);
  194.  
  195. #endif
  196.